<%@ page language="java" contentType="text/html; charset=utf-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html>
<head>
	<title>登录</title>
	<meta charset="UTF-8">
	<link rel="stylesheet" type="text/css" href="/static/index/css/public.css">
	<link rel="stylesheet" type="text/css" href="/static/index/css/common.css">
	<link rel="stylesheet" type="text/css" href="/static/index/css/logon.css">
	<link rel="stylesheet" type="text/css" href="/static/index/css/font.css">
</head>
<body>
	
	<jsp:include page="header.jsp"/>
	
	<div id="main" class="logincoent">
	
		<div class="rebackgroundimg">
			<div class="registruer">
				<div class="regrnamepwd">
					<p class="iteljk">登录<span><a href="register">未注册请先注册</a></span></p>
					<form action="toLogin" method="post">
					   <ul class="ul_form">
							<li class="user">
								<i class="iconfont icon-yonghu"></i>
								<input type="text" id="userName" class="userName" name="userName" placeholder="请输入用户名">
							</li>
							<li class="pwdmia">
								<i class="iconfont icon-mima"></i>
								<input type="password" id="passWord" class="passWord" name="passWord" placeholder="请输入密码">
							</li>
						</ul>
						<input type="submit" value="立即登录" class="sub">
						<div style="color: red;font-size: 16px;text-align: center;margin-top: 20px;">${msg}</div>
					</form>
				</div>
			</div>
		</div>
		
	</div>

	<jsp:include page="footer.jsp"/>

</body>
<script src="/static/index/js/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
	var username = false;
	var password = false;
	var reg = /[^A-z0-9]/;//正则表达式，由数字和字母组成
	//判断账号
	function checkName(){
		var userNameVal = document.getElementById('userName').value;//获取账户input中的内容
		//判断账号长度
		if (userNameVal.trim().length >= 2 && userNameVal.trim().length <=20){
			//判断是否为数字和字母组成
			if (!reg.test(userNameVal)){
				username = true;
			}else {
				alert("账号错误，账号应为数字和字母组成");
				username = false;
			}
		}else {
			alert("账号错误，长度应在2和20之间");
			username = false;
		}
	}
	//判断密码
	function checkPass(){
		var passWordVal = document.getElementById('passWord').value;//获取密码input中的内容
		//判断密码长度
		if (passWordVal.trim().length >= 2 && passWordVal.trim().length <=20){
			//判断是否为数字和字母组成
			if (!reg.test(passWordVal)){
				password = true;
			}else {
				alert("密码错误，密码应为数字和字母组成");
				password = false;
			}
		}else {
			alert("密码错误，长度应在2和20之间");
			password = false;
		}
	}
	function checkLogin(){
		if (username && password){
			return true;
		}else {
			return false;
		}
	}
</script>
</html>